#ifndef __MYTASK_HPP__
#define __MYTASK_HPP__
#include "Task.hpp"
#include "TcpConnection.hpp"
#include <iostream>
#include <string>

namespace wd
{
using std::string;

class Mytask:public wd::Task                                                              
    {
    public:
        Mytask(const string &msg,wd::TcpConnectionPtr conn)
            :_msg(msg)
             ,_conn(conn)
        {}

        void process()override{
            std:: cout<<"recv from: "<<_conn->peerInfo()<<" "
                <<_msg.size()<<" bits: "<<_msg<<std::endl;
            _conn->sendToLoop(_msg);
        } 

    private:
        string _msg;
        wd::TcpConnectionPtr _conn;
    };


}//end of namespace


#endif // __MYTASK_HPP__

